<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script type="text/js">
        var name = 'hhh';
        var obj1 = {
            name:'1',
            fn1:function (){
                console.log(this.name);
            },
            fn2:()=>console.log(this.name),
            fn3: function (){
                return function (){
                    console.log(this.name);
                }
            },
            fn4: function(){
                return () => console.log(this.name);
            }
        };
        var obj2 = {
            name: '2',
            // function (){
            //         console.log(this.name);
            //     }
        };
        obj1.fn1();//1
        obj1.fn1.call(obj2);//2

        obj1.fn2();//hhh
        obj1.fn2.call(obj2);//hhh

        obj1.fn3()();//hhh
        obj1.fn3().call(obj2);//2
        obj1.fn3.call(obj2)();//hhh

        obj1.fn4()();//hhh
        obj1.fn4().call(obj2);//1
        obj1.fn4.call(obj2)();//1 2
    </script>
</body>
</html>